#include<bits/stdc++.h>
using namespace std;
int main(void){
	queue<int>s;
	int n,i,round,x,flag = 0;
	cin>>n;
	cin>>round;
	for(i = 1;i <= n;i++){
		s.push(i);
	}
	i = 1;
	if(round>n){
		cout<<"error!";
		return 0;
	}
	while(s.front()){
		x = s.front();
		s.pop();
		if(i%round == 0){
			if(flag == 0)cout<<x;
			else cout<<" "<<x;
			flag = 1;
		}
		else s.push(x);
		i++;
	}
	return 0;
}
